<%@page language="java"  import="com.scalar.chiptrack.utils.ConfigManager,
                                 com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderForm,
                                 com.scalar.chiptrack.finance.openpo.PurchaseOrderLineItem,
                                 com.scalar.chiptrack.finance.openpo.PurchaseOrderLineItemLotDataEntry,
                                 com.scalar.chiptrack.finance.openpo.PurchaseOrderLineItemLotDataEntryList" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/purchaseOrderReceipt.do"/>

<%
    String chipTracContext = "/" + ConfigManager.getChipTracContext();
    int purchaseOrderLineItemNumber = -1;
    try{
        purchaseOrderLineItemNumber = Integer.parseInt( request.getParameter("purchaseOrderLineItemNumber") );
    }catch(NumberFormatException nfe){};
%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script language="javascript">

function addPurchaseOrderLineItemLotDataEntry( purchaseOrderLineItemNumber )
{
    document.purchaseOrderReceiptForm.action='<%=chipTracContext%>/purchaseOrderReceipt.do?action=purchaseOrderLotEntryAddMore&purchaseOrderLineItemNumber=' + purchaseOrderLineItemNumber;
    document.purchaseOrderReceiptForm.submit();
}

function SaveAndClose()
{
    document.purchaseOrderReceiptForm.action='<%=chipTracContext%>/purchaseOrderReceipt.do?action=purchaseOrderLineItemLotEntryClose';
    document.purchaseOrderReceiptForm.submit();
}

function setValuesAndClose()
{
    <%
    if ( request.getParameter( "openRecevingLineItemLotEntry" ) != null )
    {
    %>
        window.opener.reload();
    <%
    }
    %>
    window.close();
}
</script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" onload="javascript:setValuesAndClose()">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
        <TD bgcolor="#ffffff">
            <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
<!-- from here your body starts -->
<html:form name="purchaseOrderReceiptForm"  type="com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderReceiptForm" action="/purchaseOrderReceipt.do">

             <table border="0" align = "left" width ="100%" >
             <TR>
                    <TD WIDTH="100%">
                        <TABLE BORDER="0" WIDTH="100%" HEIGHT="175%">
                            <TR>
                                <TD WIDTH="100%" align = "">
                                    <table width="75%" ALIGN="CENTER"><tr><td><center><FONT id="poErrors" styleClass="NArialL"><b>Purchase Order Line Item Lot Data Entry</b></FONT></center></td></TR></table>
                                </TD>
                            </TR>
                        </TABLE>
                        <BR>
                        <TABLE BORDER="0" ALIGN="CENTER" WIDTH="75%" CLASS="NArialL">
                            <TR>
                                <TD WIDTH="25%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                    <P ALIGN="CENTER">&nbsp;<FONT COLOR="white">Lot Number</FONT>
                                </TD>
                                <TD WIDTH="25%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                    <P ALIGN="CENTER">&nbsp;<FONT COLOR="white">Quantiy In</FONT>
                                </TD>
                                <TD WIDTH="25%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                    <P ALIGN="CENTER"><FONT COLOR="white">Quantity Out</FONT>
                                </TD>
                            </TR>
                            <nested:iterate id="recevingLineItem" property="receivingLineItemList" type="com.scalar.chiptrack.finance.openpo.ReceivingLineItem">
                                <nested:equal name="recevingLineItem" property = "purchaseOrderLineItemNumber"  value = "<%= String.valueOf( purchaseOrderLineItemNumber )%>" >
                                    <nested:hidden property="purchaseOrderLineItemNumber"/>
                                    <nested:iterate id = "purchaseOrderLineItemLotDataEntry" property="purchaseOrderLineItemLotDataEntryList" type="com.scalar.chiptrack.finance.openpo.PurchaseOrderLineItemLotDataEntry">
                                    <TR>
                                        <TD WIDTH="25%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
                                            <CENTER>
                                            <P><nested:text property="lotNumber" styleClass="txfield" size="19"/>
                                            </CENTER>
                                        </TD>
                                        <TD WIDTH="25%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
                                            <CENTER>
                                            <P><nested:text property="qtyIns" styleClass="txfield" size="19"/>
                                            </CENTER>
                                        </TD>
                                        <TD WIDTH="25%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
                                            <CENTER>
                                            <P><nested:text property="qtyOut" styleClass="txfield" size="19"/>
                                            </CENTER>
                                        </TD>
                                    </TR>
                                    </nested:iterate>
                                </nested:equal>
                            </nested:iterate>
                            <TR><TD>&nbsp;</TD></TR>
                            <TR><TD>&nbsp;</TD></TR>
                            <TR align = "center" border="0">
                                <TD  bgColor= "" align="right" colspan = '3'>
                                <% String jsMethod = "javascript:addPurchaseOrderLineItemLotDataEntry('" + purchaseOrderLineItemNumber + "')" ; %>
                                <A href="<%=jsMethod%>"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/addmore.gif" onmouseover="window.status='Click to Create PO';return true" onmouseout="window.status='';return true" title="Click here to Create PO"></A>&nbsp;&nbsp;&nbsp;

                                </TD>
                            </TR>
                            <TR><TD>&nbsp;</TD></TR>
                            <TR align = "center" border="0">
                                <TD  bgColor= "" align="center" colspan = '3'>
                                <A href="javascript:SaveAndClose()" ><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" onmouseover="window.status='Click to Create PO';return true" onmouseout="window.status='';return true" title="Click here to Create PO"></A>&nbsp;&nbsp;&nbsp;
                                <A href="javascript:window.close()" onMouseOver="window.status='Click to Reset the PO Information';return true" onMouseOut="window.status='';return true" title="Click here to Reset Process Information"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></a>
                                </TD>
                            </TR>
                        </TABLE>
                        <BR>
              </TABLE>
</html:form>
        <BR><BR><BR>
        </TD>
        <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>
</BODY>
</HTML>
